package com.hotel.product.controller;


import com.hotel.product.service.ProductService;
import com.hotel.user.entity.Product;
import com.hotel.user.entity.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author KK
 * @since 2024-06-18
 */
@RestController
@RequestMapping("/api/products")
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("/getAll")//这是获取全部商品的接口，刚刚写的那个是购买单个的接口
    public List<Product> getAllProducts() {
       /* List<Product> products = productService.getAllProducts();
        return new ResponseDTO<>(200, "Success", products);*/
        return productService.getAllProducts();
    }
}

